package com.cjm.one.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.SecurityConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.custom.client.CustomerBalanceRecordClient;
import com.cjm.one.model.custom.entity.CustomerBalanceRecord;
import com.cjm.one.service.CustomerBalanceRecordService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class CustomerBalanceRecordImpl implements CustomerBalanceRecordService {
    @Resource
    private CustomerBalanceRecordClient customerBalanceRecordClient;
    @Override
    public Result<Page<CustomerBalanceRecord>> getCustomerBalanceRecordPage(Integer current, Integer size) {
        return customerBalanceRecordClient.list(current, size);
    }

    @Override
    public Result<BigDecimal> getCustomerBalance() {
        return customerBalanceRecordClient.info();
    }

    @Override
    public Result<Boolean> addCustomerBalance(CustomerBalanceRecord customerBalanceRecord) {
        return customerBalanceRecordClient.add(customerBalanceRecord, SecurityConstants.INNER);
    }
}
